<!-- S search -->
<app-search-bar
  [submitLoading]="tableParams.loading"
  [searchOptions]="searchOptions"
  labelFlex="80px"
  (onSearch)="queryResetData($event)"
  (onReset)="queryResetData($event)"
>
</app-search-bar>
<!-- E search -->

<nz-card class="m-t-4">
  <div class="pagination-wrap-position">
    <nz-table
      #basicTable
      nzSize="small"
      nzShowSizeChanger
      nzShowQuickJumper
      nzOuterBordered
      [nzScroll]="{ x: '1100px' }"
      [nzFrontPagination]="false"
      [nzLoadingDelay]="100"
      [nzLoading]="tableParams.loading"
      [nzData]="tableParams.tableData"
      [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
      [nzTotal]="tableParams.total"
      [nzPageIndex]="tableParams.page"
      [nzPageSize]="tableParams.pageSize"
      [nzShowTotal]="totalTemplate"
      (nzPageIndexChange)="onPageIndexChange($event)"
      (nzPageSizeChange)="onPageSizeChange($event)"
    >
      <thead>
        <tr>
          <th nzAlign="center" nzWidth="200px" nzLeft>入库单号</th>
          <th nzAlign="center" nzWidth="120px">入库类型</th>
          <th nzAlign="center" nzWidth="120px">状态</th>
          <th nzAlign="center" nzWidth="150px">要求入库</th>
          <th nzAlign="center" nzWidth="150px">实际入库</th>
          <th nzAlign="center" nzWidth="120px">入库仓库</th>
          <th nzAlign="center" nzWidth="120px">入库品质</th>
          <th nzAlign="center" nzWidth="170px">入库完毕时间</th>
          <th nzAlign="center" nzWidth="250px" nzRight>操作</th>
        </tr>
      </thead>

      <tbody>
        <tr *ngFor="let data of basicTable.data; let index = index;">
          <!-- 入库单号 -->
          <td nzAlign="center" nzLeft>
            <a
              style="color: #409EFF;"
              routerLink="/storage-center/storage-warehous-handle"
              [queryParams]="{id: data.id, whId: data.whPutId}">
              {{ data.warehousingNumber || '-' }}
            </a>
          </td>
          <!-- 入库类型 -->
          <td nzAlign="center">
            <span>
              {{ filterText(putTypeOptions, data.type, 'content') }}
            </span>
          </td>
          <!-- 状态 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.state | storePutStatus: 'color'}">
              {{ data.state | storePutStatus: 'label' }}
            </span>
          </td>
          <!-- 要求入库 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.purchaseContent !== data.storedContent ? '#FF9900' : ''}">
              {{ data.purchaseContent || '-' }}
            </span>
          </td>
          <!-- 实际入库 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.purchaseContent !== data.storedContent ? '#FF9900' : ''}">
              {{ data.storedContent || '-' }}
            </span>
          </td>
          <!-- 入库仓库 -->
          <td nzAlign="center">
            {{ filterText(warehouseOptions, data.whPutId, 'id') }}
          </td>
          <!-- 入库品质 -->
          <td nzAlign="center">
            <span>
              {{ data.quality === 0 ? '不良品' : (data.quality === 1 ? '良品' : '-') }}
            </span>
          </td>
          <!-- 入库完毕时间 -->
          <td nzAlign="center">{{ data.warehousingTime || '-' }}</td>
          <!-- 操作 -->
          <td nzAlign="center" nzRight>
            <button
              nz-button
              nzType="link"
              nzSize="small"
              routerLink="/storage-center/storage-warehous-handle"
              [queryParams]="{id: data.id, whId: data.whPutId}"
            >查看</button>

            <!-- <button
              *ngIf="permission.userPermission.has('storageCenter:put:confirmRk') && data.state === 3"
              nz-button
              nzType="link"
              nzSize="small"
              nzDanger
              (click)="confirmWarehous(data)"
            >确认入库</button> -->

            <button
              nz-button
              nzType="link"
              nzSize="small"
              (click)="showFollowModal(data)"
            >跟进</button>
          </td>
        </tr>
      </tbody>
    </nz-table>

    <!-- 分页template -->
    <ng-template #totalTemplate let-total>共有 {{ total }} 条</ng-template>
  </div>
</nz-card>

<!-- S 跟进Component -->
<app-follow-up
  #followUpRef
  [initParams]="initParams"
  [ohterParams]="{ type: 0, sourceType: 99 }"
></app-follow-up>
<!-- E 跟进Component -->